---
title: "My Plots"
output:
flexdashboard::flex_dashboard:
orientation: column
vertical_layout: fill
theme: united
source: embed
---
```{r setup, include=FALSE}
library(tidyverse)
library(dplyr)
library(p8105.datasets)
library(plotly)
library(flexdashboard)
data("rest_inspec")
```
Column {data-width=650}
--------------------------------------------------------------------
### Chart A
```{r, echo=FALSE, message=FALSE}
inspect1 = rest_inspec %>%
drop_na(score) %>%
sample_n(10000)
inspect2 = inspect1 %>%
filter(score > 60) %>%
group_by(boro) %>%
summarize(score_count = n())
plot_ly(inspect2 ,x = ~boro, y = ~score_count, type = "bar", colors = "viridis") %>%
layout(title = 'Scores of > 60 by Borough',
xaxis = list(title = 'Boroughs of NY'),
yaxis = list(title = 'Count'))
```
Column {data-width=350}
-------------------------------------------------------------------
### Chart B
```{r, echo=FALSE, message=FALSE}
inspect4 = inspect1 %>%
janitor::clean_names() %>%
drop_na() %>%
filter(cuisine_description == "American", inspection_type == "Cycle Inspection / Initial Inspection") %>%
group_by(boro) %>%
mutate(boro = as.factor(boro))
plot_ly(inspect4, x = ~boro, y = ~score, color = ~boro, type = "box") %>%
layout(title = 'Distribution of Health Scores for American-Style Restaurants Across Boroughs',
xaxis = list(title = 'Boroughs of NY'),
yaxis = list(title = 'Score Distribution'))
```
### Chart C
```{r, echo=FALSE, message=FALSE}
inspect5 = inspect1 %>%
janitor::clean_names() %>%
drop_na() %>%
filter(cuisine_description == "Chinese", inspection_type == "Cycle Inspection / Initial Inspection") %>%
group_by(boro) %>%
mutate(boro = as.factor(boro))
plot_ly(inspect4, x = ~boro, y = ~score, color = ~boro, type = "box") %>%
layout(title = 'Distribution of Health Scores for Chinese-Style Restaurants Across Boroughs',
xaxis = list(title = 'Boroughs of NY'),
yaxis = list(title = 'Score Distribution'))
```